package G;

import java.util.Scanner;
public class Training03 {
    public static void main(String[] args) {
        int[] arr = getUserInput();
        printIntArray(arr);
        // todo 1.将用户输入的数字中奇数显示出来
        // 函数内部编写循环结构进行条件判断
        showOdd(arr);
        // todo 2.将用户输出的数字钟的偶数显示出来
        // 函数内部编写循环结构进行条件判断
        showEven(arr);
    }
    public  static void showOdd(int []arr){
        int sum = 0;
        for (int i = 0;i<arr.length;i++){
            if (arr[i]%2 ==0){
                continue;
            }
            System.out.println(arr[i]+"");
        }
        System.out.println("\n");
    }
    public  static void showEven(int []arr){
        for (int i = 0;i<arr.length;i++){
            if ((arr[i]%2-1 ==0)){
                continue;
            }
            System.out.println(arr[i]+"");
        }
    }
    public static int[] getUserInput() {
        System.out.println("请随机输入五个整数");
        Scanner sc = new Scanner(System.in);
        int[] arr = new int[5];
        for (int i = 0; i < arr.length; i++) {
            System.out.print("请输入数字:");
            arr[i] = sc.nextInt();
        }
        return arr;
    }
    public static void printIntArray(int[] arr) {
        System.out.println("你输入的数字是:");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
        System.out.print("\n");
    }
}
